package ui.tools;

import java.awt.event.InputEvent;

import ui.EditController;

/**
 * EditTool for adding stones.
 * @author TKington
 *
 */
public class StoneTool extends EditTool {
	@Override
	public boolean mouseClicked(int x, int y, int modifiers) {
		EditController controller = EditController.instance();
		
		int color;
		if((modifiers & InputEvent.BUTTON1_MASK) > 0)
			color = 1;	// Black
		else color = -1;

		int stoneColor = controller.getAt(x, y);
		if(stoneColor == color)
			controller.setAt(x, y, 0);
		else controller.setAt(x, y, color);
		
		return true;
	}
}
